﻿using AutoMapper;

namespace XUCore.Ddd.Domain
{
    /// <summary>
    /// 命令Mapping
    /// </summary>
    public abstract class CommandMap<TDestination> : Command<bool>, ICreateMap<TDestination>
    {
        public virtual void Mapping(Profile profile) => profile.CreateMap(GetType(), typeof(TDestination), MemberList.None);
    }
    /// <summary>
    /// 创建命令
    /// </summary>
    public abstract class CreateCommand : Command<bool>
    {

    }
    /// <summary>
    /// 创建命令
    /// </summary>
    /// <typeparam name="TDestination">目标对象</typeparam>
    public abstract class CreateCommand<TDestination> : CreateCommand, ICreateMap<TDestination>
    {
        public virtual void Mapping(Profile profile) => profile.CreateMap(GetType(), typeof(TDestination), MemberList.None);
    }
    /// <summary>
    /// 更新命令
    /// </summary>
    /// <typeparam name="TKey"></typeparam>
    public abstract class UpdateCommand<TKey> : CommandId<bool, TKey>
    {

    }
    /// <summary>
    /// 更新命令
    /// </summary>
    /// <typeparam name="TKey"></typeparam>
    /// <typeparam name="TDestination">目标对象</typeparam>
    public abstract class UpdateCommand<TKey, TDestination> : UpdateCommand<TKey>, ICreateMap<TDestination>
    {
        public virtual void Mapping(Profile profile) => profile.CreateMap(GetType(), typeof(TDestination), MemberList.None);
    }
    /// <summary>
    /// 列表命令
    /// </summary>
    public abstract class ListCommand : CommandLimit<bool>
    {

    }
    /// <summary>
    /// 分页命令
    /// </summary>
    public abstract class PageCommand : CommandPage<bool>
    {

    }
}
